﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TM.QWeibo.Client.UserControls
{
    public partial class UserAvatar : UserControl
    {
        public UserAvatar()
        {
            InitializeComponent();
        }

        /// <summary>  
        /// 绑定用户信息
        /// </summary>
        /// <param name="userInfo"></param>
        public void BindInfo(SDK.Objects.UserInfo userInfo) {

            Dispatcher.BeginInvoke(() => {
                LayoutRoot.DataContext = userInfo;
            });
        }
        #region 公共属性

        /// <summary>
        /// 点击事件
        /// </summary>
        public Action<string> TapAvatar { get; set; }

        #endregion

        private void LayoutRoot_Tap(object sender, GestureEventArgs e)
        {
            if (TapAvatar != null) {
                TapAvatar(tbUserName.Text);
            }
        }
    }
}
